﻿<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="renderer" content="webkit" />
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>项目管理</title>

    <!-- Bootstrap -->
    <link href="../../CSS/bootstrap3.2/css/bootstrap.css" rel="stylesheet">
    <link href="../../JqueryPlug/plupload-2.1.2/js/jquery.plupload.queue/css/jquery.plupload.queue.css" rel="stylesheet">

    <!--[if lt IE 9]>
      <script src="../Scripts/html5shiv.js"></script>
      <script src="../Scripts/respond.js"></script>
    <![endif]-->

</head>
<body>

    <div>
        <div id="uploader">
        </div>
    </div>
    <script src="../../Scripts/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="../../JqueryPlug/plupload-2.1.2/js/plupload.full.min.js"></script>
    <script type="text/javascript" src="../../JqueryPlug/plupload-2.1.2/js/jquery.plupload.queue/jquery.plupload.queue.min.js"></script>
    <script type="text/javascript" src="../../JqueryPlug/plupload-2.1.2/js/i18n/zh_CN.js"></script>
    <script type="text/javascript" src="../../Scripts/json2.js"></script>

    <script>
        var fjdata = [];
        $(document).ready(function () {
            var TypeID = getQueryString("TypeID");
            var UserName = getQueryString("UserName");
            var FileType = getQueryString("FileType");
            var filter = [];
            if (FileType == 'pic') {
                filter = [{ title: "Image files", extensions: "jpg,gif,png" }];
            }
            $("#uploader").pluploadQueue({
                // General settings
                runtimes: 'html5,flash,gears', // 这里是说用什么技术引擎
                url: 'UploadFiles.ashx?TypeID=' + TypeID + '&UserName=' + UserName, // 服务端上传路径
                max_file_size: '100mb', // 文件上传最大限制。
                chunk_size: '100mb', // 上传分块每块的大小，这个值小于服务器最大上传限制的值即可。
                unique_names: true, // 上传的文件名是否唯一
                dragdrop: true,
                height: 500,
                multipart_params: {
                    ProName: '123'

                },

                // Resize images on clientside if we can
                //// 是否生成缩略图（仅对图片文件有效）
                resize: { quality: 80, preserve_headers: false },
                // Specify what files to browse for
                ////  这个数组是选择器，就是上传文件时限制的上传文件类型
                filters: {
                    mime_types: filter,
                    // max_file_size: '1000kb', //最大只能上传400kb的文件
                    prevent_duplicates: true //不允许选取重复文件
                },
                // Flash settings
                // plupload.flash.swf 的所在路径
                flash_swf_url: '../../JqueryPlug/plupload-2.1.2/js/Moxie.swf',
                multiple_queues: true
            });
            var uploaderdom = $('#uploader').pluploadQueue();
            uploaderdom.bind('FileUploaded', function (uploader, file, res) {
                //上传一个文件执行一次
                // var fj = { "id": res.response, "filename": file.name, "filesize": file.size }
                fjdata.push($.parseJSON(res.response));
            });
            uploaderdom.bind('FilesAdded', function (uploader, files) {
                uploaderdom.start();

            });
            uploaderdom.bind('UploadComplete', function (uploader, files) {
                //全部上传完毕事件
            });
            $(".plupload_header").remove();
            $(".plupload_start").hide();

        });

        var getQueryString = function (name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            var r = window.location.search.substr(1).match(reg);
            if (r != null) return unescape(r[2]); return null;
        }

        function getfjdata() {
            return fjdata;
        }
    </script>
</body>
</html>
